package org.scboy.dbms.valid.datatype;

import java.util.List;

import org.scboy.dbms.annotation.ValidType;
import org.scboy.dbms.entity.ParamConfig;
import org.scboy.dbms.valid.Valid;
import org.scboy.dbms.valid.common.RegxValid;
import org.scboy.utils.entitys.coobi.Model;

@ValidType("汉字")
public class ChineseValid extends RegxValid implements Valid  {

	String regex = "^[\u4e00-\u9fa5]*$";
	
	@Override
	public List<ParamConfig> config() {
		return null;
	}
	
	@Override
	public String toString(Model config) {
		return "必须输入的为汉字。";
	}
	
	@Override
	public boolean valid(Object value,Model model, Model config) {
		config=Model.create();
		config.put("expression", regex);
		return super.valid(value,model, config);
	}
	
}
